﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace 人事工资管理系统
{
    public partial class frmChangePwd : Form
    {
        public frmChangePwd()
        {
            InitializeComponent();
        }
        PMSClass.DBOperate operate = new PMSClass.DBOperate();
        private void frmChangePwd_Load(object sender, EventArgs e)
        {
            try
            {
                operate.BindDropdownlist("tb_User", comboBox1, 1);
                comboBox1.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }


        private void toolStripLabel1_Click(object sender, EventArgs e)
        {

            string str = "update tb_User set UserPwd='" + textBox2.Text.Trim() + "'where UserName='"+comboBox1.SelectedItem.ToString()+"'";
            operate.OperateData(str);
            MessageBox.Show("修改成功", "警告", MessageBoxButtons.OK, MessageBoxIcon.Information);
            

        }

        private void toolStripLabel2_Click(object sender, EventArgs e)
        {
            this.Close() ;
        }

        private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)
            {
                toolStripLabel1_Click(sender, e);
            }
        }
    }
}
